package com.slz3.business.module.orderManagement.ordRefund.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class OrdRefundFactory {

    /**
     * 初始化基础属性值
     */
    public static OrdRefund initBaseFields(OrdRefund ordRefund) {
        if (ordRefund.getUuid() == null) {
            ordRefund.setUuid(UUIDUtils.generateUUID());
            ordRefund.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(ordRefund.getSerAudit())) {
                ordRefund.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(ordRefund.getSerUsing())) {
                ordRefund.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            ordRefund.setLastModifyTime(LocalDateTime.now());
        }
        return ordRefund;
    }

    /**
     * 初始化基础属性值
     */
    public static OrdRefund initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static OrdRefund newTemStyle() {
        return new OrdRefund();
    }

}
